package com.bd.wechat.utils;

import org.springframework.web.multipart.MultipartFile;

public class FileCheckUtils {


    public static Boolean checkMediaType(MultipartFile file) {
        if (file == null || file.isEmpty()) {
            return false;
        }
        String contentType = file.getContentType();
        if (contentType != null) {
            if (contentType.startsWith("image/")) {
                return true;
            } else if (
                    contentType.startsWith("video/") ||
                            contentType.equals("application/octet-stream") // 注意：某些视频文件可能被报告为此类型
            ) {
                return true;
            }
        }
        return false;

    }
}
